package com.jk.xz.controller;

import com.jk.AddressBean;
import com.jk.CinemaBean;
import com.jk.MovieHallBean;
import com.jk.xz.service.CinemaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;

/*
 * @Author: xz
 * @Description: 影院管理
 * @Date: 2021/5/19 16:36
 * @Param:
 * @Return:
 **/
@RestController
@RequestMapping("cinema")
public class CinemaController {
    @Autowired
    private CinemaService cinemaService;
    /*
     * @Author: xz
     * @Description: 查询影院
     * @Date: 2021/5/19 16:42
     * @Param:[page, rows, cinema]
     * @Return: java.util.HashMap<java.lang.String,java.lang.Object>
     **/
    @RequestMapping("queryCinema")
    public HashMap<String,Object> queryCinema(Integer page, Integer rows,CinemaBean cinema){
        return cinemaService.queryCinema(page,rows,cinema);
    }
    /*
    * @Author: xz
    * @Description: 根据影院id查询对映的影厅
    * @Date: 2021/5/19 21:44
    * @Param:[id]
    * @Return: java.util.List<com.jk.MovieHallBean>
    **/
    @RequestMapping("getHall")
    public List<MovieHallBean> getHall(Integer id){

        return cinemaService.getHall(id);
    }
    /*
    * @Author: xz
    * @Description:获取市
    * @Date: 2021/5/20 11:04
    * @Param:[]
    * @Return: java.util.List<com.jk.AddressBean>
    **/
    @RequestMapping("getCity")
    public List<AddressBean> getCity(){
        return cinemaService.getCity();
    }
    /*
     * @Author: xz
     * @Description:获取县
     * @Date: 2021/5/20 11:04
     * @Param:[]
     * @Return: java.util.List<com.jk.AddressBean>
     **/
    @RequestMapping("getCounty")
    public List<AddressBean> getCounty(Integer cityId){
        return cinemaService.getCounty(cityId);
    }

    /*
    * @Author: xz
    * @Description: 新增影院
    * @Date: 2021/5/20 11:39
    * @Param:
    * @Return:
    **/
    @RequestMapping("addCinema")
    public void addCinema(CinemaBean cinema){
        cinemaService.addCinema(cinema);
    }
    /*
    * @Author: xz
    * @Description: 删除影院
    * @Date: 2021/5/20 14:09
    * @Param:
    * @Return:
    **/
    @RequestMapping("delAll")
    public void delAll(String[] ids){
        cinemaService.delAll(ids);
    }
    /*
    * @Author: xz
    * @Description: 根据id回显影院
    * @Date: 2021/5/20 14:14
    * @Param:
    * @Return:
    **/
    @RequestMapping("byId")
    public CinemaBean byId(Integer cinemaId){
      return  cinemaService.byId(cinemaId);
    }
    /*
    * @Author: xz
    * @Description: 查询影厅
    * @Date: 2021/5/20 15:36
    * @Param:
    * @Return:
    **/
    @RequestMapping("queryHall")
    public HashMap<String,Object> queryHall(Integer page, Integer rows, MovieHallBean hall, HttpSession session){
        return cinemaService.queryHall(page,rows,hall,session);
    }
    /*
    * @Author: xz
    * @Description: 新增+修改影厅
    * @Date: 2021/5/20 16:28
    * @Param:
    * @Return:
    **/
    @RequestMapping("addHall")
    public void addHall(MovieHallBean hall){
         cinemaService.addHall(hall);
    }
    /*
    * @Author: xz
    * @Description: 查询影院
    * @Date: 2021/5/20 16:51
    * @Param:[]
    * @Return: java.util.List<com.jk.CinemaBean>
    **/
   /* @RequestMapping("getCinema")
     public List<CinemaBean> getCinema(){
        return cinemaService.getCinema();
    }*/

  /*
  * @Author: xz
  * @Description: 回显hall
  * @Date: 2021/5/20 17:53
  * @Param:
  * @Return:
  **/
  @RequestMapping("getHallById")
  public MovieHallBean getHallById(Integer hallId){
   return cinemaService.getHallById(hallId);
  }
  @RequestMapping("delHall")
  public void delHall(Integer id){
      cinemaService.delHall(id);
  }
}
